package com.yehangtech.designpattern.创建者_原型模式.entity;

// todo:原型模式的精髓就是重写object的clone方法
public class Student implements Cloneable {
    private String name;

    private Integer age;

    private Father father;

    private Boolean sex;

    public Student() {
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        Student clone = (Student) super.clone();
        clone.setName(name);
        clone.setAge(age);
        clone.setSex(sex);
        clone.setFather(father);
        return clone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Father getFather() {
        return father;
    }

    public void setFather(Father father) {
        this.father = father;
    }

    public Boolean getSex() {
        return sex;
    }

    public void setSex(Boolean sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", father=" + father +
                ", sex=" + sex +
                '}';
    }
}
